package monster;

import java.util.Objects;

public class Attack {
	private String name;
	private int points;
	
	public Attack(String name, int points) {
		this.name = name;
		this.points = points;
	}

	public String getName() {
		return name;
	}

	public int getPoints() {
		return points;
	}

	@Override
	public String toString() {
		return name + " (" + points + ")";
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Attack that = (Attack) obj;
		return((this.getName() == null ? that.getName() == null : this.getName().equals(that.getName()))
				&& (this.getPoints() == 0 ? that.getPoints() == 0 : this.getPoints() == that.getPoints()));

	}

	@Override
	public int hashCode() {
		final int init = 31;
		int result = 17;
		result = init * result + ((getName() == null) ? 0 : getName().hashCode());
		result = init * result + ((getPoints() == 0) ? 0 : Monster.hash32shift(getPoints()));
		return result;
	}

}
